//
//  SupportCategoryModel.m
//  quxiangtao
//
//  Created by xbmios on 2018/9/30.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "SupportCategoryModel.h"

@implementation SupportCategoryModel

+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return @{@"classId": @"id"};
}

+ (void)supportCategoryModelwithSuccess:(HttpRequestSuccess)successBlock fail:(HttpRequestFailed)failblock {
    
    [PPNetworkHelper POST:@"goods/Qxtgoods/goodsClass" parameters:nil success:^(id responseObject) {
        
        NSLog(@"自营商品分类:%@", responseObject);
        
        NSArray *array = responseObject[@"data"];
        
        NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:responseObject];
        
        if (array.count > 0) {
            NSArray *arr = [SupportCategoryModel mj_objectArrayWithKeyValuesArray:array];
            [dict removeObjectForKey:@"data"];
            [dict setObject:arr forKey:@"data"];
        }
        
        if (successBlock) {
            
            successBlock(dict);
        }
        
        
    } failure:^(NSError *error) {
        
        if (failblock) {
            
            failblock(error);
            
        }
        
    }];
    
}

@end
